package com.tuyuan.alramautorobot.time.config;

import com.tuyuan.alramautorobot.time.model.request.AutoBaseMessageBO;
import com.tuyuan.alramautorobot.time.model.request.MessageBO;
import lombok.Data;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;

@Data
@Component
public class DailyLogConfig {

    @Value(value = "${robot.daily.url:https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=74011b5b-fb1f-473f-9dec-e49e20216304}")
    public  String DailyLogRobotUrl ;


    @Value(value = "${robot.daily.clock:https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=e36f6c81-694d-4c19-af94-9377f57b4e0a}")
    public String AutoClockRobotUrl;
    /**
     * 返回请求实体
     * @return
     */
    public MessageBO getDailyLogAlarmQuest(){
        AutoBaseMessageBO build = AutoBaseMessageBO.builder().to("@all")
                .content("当前时间：" + LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")) +"\n"+
                        "小机器人提醒你：'别忘喽,填写当天日志哦!'").time(LocalDateTime.now()).build();
        MessageBO text = MessageBO.builder().logBO(build).msgType("text").build();
        return text;
    };



    /**
     * 返回请求实体
     * @return
     */
    public MessageBO getAutoOnClockAlarmQuest(){
        AutoBaseMessageBO build = AutoBaseMessageBO.builder().to("@all")
                .content("当前时间：" + LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")) +"\n"+
                        "小机器人提醒你：'上班时间到啦，别忘记打卡哦!'").time(LocalDateTime.now()).build();
        MessageBO text = MessageBO.builder().logBO(build).msgType("text").build();
        return text;
    };



    /**
     * 返回请求实体
     * @return
     */
    public MessageBO getAutoOffClockAlarmQuest(){
        AutoBaseMessageBO build = AutoBaseMessageBO.builder().to("@all")
                .content("当前时间：" + LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")) +"\n"+
                        "小机器人提醒你：'下班时间到啦，别忘记打卡哦!'").time(LocalDateTime.now()).build();
        MessageBO text = MessageBO.builder().logBO(build).msgType("text").build();
        return text;
    };
}
